package com.zy.yun.core.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Date: 2019/4/14 22:26
 * @Description: 接口配置 参考：https://www.cnblogs.com/mao2080/p/8991027.html
 * @Author Administrator
 */

@Configuration
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("前端接口管理")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zy.yun.controller.app"))
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public Docket createComplaintRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("后端接口管理")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zy.yun.controller.sys"))
                .paths(PathSelectors.any())
                .build();
    }



    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("接口文档管理")
                .description("接口文档管理")
                .termsOfServiceUrl("http://localhost:8899")
                .contact("617423230@qq.com")
                .version("1.0")
                .build();
    }

}
